#!/bin/bash

hadoop_cmd=`which hadoop`
awk_cmd=`which awk `
Cat_cmd=`which cat `
hdfs_cmd=`which hdfs`

#####多进程定义#####
thread=10
tmp_fifo="/tmp/$$.fifo"
mkfifo $tmp_fifo
exec 6<> $tmp_fifo 
rm $tmp_fifo

#定义线程数
{
for (( i=0;i<$thread;i++));
        do
                echo 
        done 
} >&6  #实际上就是在fd6中放置了$thread个回车符

src_h='hdfs://172.17.128.1:9820'
LogList=()

for i in {1..3}
do
        $Cat_cmd $1 | awk '{print $1}' |
        while read file
        do
                read -u6
                {
			#echo "$file"
			#echo "$hadoop_cmd distcp -skipcrccheck -update $src_h$file $file"
                        #$hdfs_cmd dfs -mkdir -p $file
                        #$hdfs_cmd  ec -setPolicy -path $file
			#$hadoop_cmd dfs -rm -r $file/.distcp.tmp.attempt*
                        #$hadoop_cmd distcp -m 40 -skipcrccheck -update -bandwidth 500 $src_h$file $file
                        $hadoop_cmd distcp -m 80 -skipcrccheck -update -bandwidth 2000 $src_h$file $file
                        echo >&6
                } &
        done
done
